Xbasic

INDEX.CLOSE Function

Syntax

V Close()

Description

The .CLOSE() method closes an index file or query list.

Discussion

The index file or query list is specified by the object pointer that references any of the tags in the index. If the object pointer is for a query list, then only the query list will be detached. Before you can delete an index file (using the FILE.REMOVE() method), you must first close it using the .CLOSE() method. Every time a table is opened, its production index (if it exists) is also automatically opened. The production index has the same filename as the table. If you wish to delete a table's production index, you must first close it using the .CLOSE() method. After an index file is closed the index tags in the file are not updated when records are added or edited. When you subsequently re-open the index file, you will have to use the <INDEX>.UPDATE() method to update the indexes in the file.

Example

Closes the production index file for the current table. You can then delete the index file and rebuild the index.

dim tbl as P
dim index_tag_name as C
tbl = table.current()
'Get the tag name of the first tag in the production index
index_tag_name = tbl.index_name_get(1)
'Set the index to to the first tag in the index file. This will
'get a pointer to the first tag in the index file.
index_pointer = tbl.index_primary_put(index_tag_name)
'Now that you have a pointer to the index file, close it.
index_pointer.close()

See Also